﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuickTimeEntryControl.ascx.cs" Inherits="SimplePMT.Control.QuickTimeEntryControl" %>
<form name="taskForm" id="taskForm">
<input type="hidden" name="TaskID" value="<%= task.ID %>" />
<input type="hidden" name="TaskContainerID" value="<%= taskContainerId %>" />
<% if (task.ID > 0) { %>
<input type="hidden" name="HoursEstimated" value="<%= task.HoursEstimated %>" />
<input type="hidden" name="ComplexityEstimatedID" value="<%= task.ComplexityEstimatedID %>" />
<% } else { %>
<input type="hidden" name="Notes" value="" />
<input type="hidden" name="Hours" value="0" />
<input type="hidden" name="IsComplete" value="0" />
<input type="hidden" name="ComplexityActualID" value="0" />
<input type="hidden" name="NoteDateTime" value="" />
<% } %>
<table width="100%" cellpadding=3>
        <tr>
            <td style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE"><%= taskLocation %> : <b><%= taskTitle %></b></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" bgcolor="#ffffff" valign=top>
                <div id="TaskView">
                <table width="100%" align=center>
                <% if (task.ID > 0)
                   { %>
                    <tr>
                        <td align=right><b>Task Number:</b></td>
                        <td>
                            <table cellspacing=0 border=0 cellpadding=0>
                                <tr>
                                    <td><%= task.ID%> (for subversion association)</td>
                                    <td align=right>&nbsp;&nbsp;&nbsp;<b>Release:</b></td>
                                    <td>&nbsp;<%= FormElement.Select(210, "ReleaseID", selectedRelease, releaseOptions, "", edit)%></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                <% }
                   else
                   { %>
                    <tr>
                        
                        <td align=right>&nbsp;&nbsp;&nbsp;<b>Release:</b></td>
                        <td><%= FormElement.Select(210, "ReleaseID", selectedRelease, releaseOptions, "", edit)%></td>
                    </tr>
                <% } %>
                    <tr>
                        <td align=right><b>Title:</b></td>
                        <td><%= FormElement.TextBox(75, "Title", taskTitle.Replace("New Task", ""), "", edit) %></td>
                    </tr>
                    <tr>
                        <td align=right valign=top><b>Description:</b></td>
                        <td><%= FormElement.TextArea(76, 8, "Description", task.Description, "", edit) %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Task Type:</b></td>
                        <td><%= FormElement.Select(150, "TaskTypeID", taskTypeId, taskTypeOptions, "", edit) %>&nbsp;&nbsp;&nbsp;<b>Priority:</b>&nbsp;<%= FormElement.Select(150, "PriorityID", taskPriorityId, taskPriorityOptions, "", edit) %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Created By:</b></td>
                        <td><%= createdBy %> (on <%= createDate %>)</td>
                    </tr>
                    <tr>
                        <td align=right><b>Assigned To:</b></td>
                        <td>
                            <table cellspacing=0 border=0 cellpadding=0>
                                <tr>
                                    <td><%= FormElement.Select(150, "AssignedMemberID", task.AssignedMemberID, memberOptions, "", edit)%></td><td><% if (task.AssignedMemberID > 0) { %>&nbsp;(on <%= assignDate %>)<% } %></td>
                                    <td align=right>&nbsp;&nbsp;&nbsp;<b>Status:</b></td>
                                    <td>&nbsp;<%= FormElement.Select(110, "TaskStatus", stateOptionSelected, taskStateOptions, "", edit)%></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align=right><b>Est.&nbsp;Hours:</b></td>
                        <td><%= FormElement.TextBox(2, "HoursEstimated", task.HoursEstimated.ToString(), "", (task.ID == 0)) %>&nbsp;&nbsp;
                        <% if (task.ID > 0) { %><b>Actual&nbsp;Hours:</b>&nbsp;<%= taskHours %><% } %>
                        </td>
                    </tr>
                    <tr>
                        <td align=right><b>Est.&nbsp;Complexity:</b></td>
                        <td valign=top><table cellspacing=0 border=0 cellpadding=0><tr><td><%= FormElement.Select(150, "ComplexityEstimatedID", task.ComplexityEstimatedID, complexityOptions, "", task.ID.Equals(0))%></td><% if (task.ID > 0) { %><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Actual&nbsp;Complexity:</b></td><td>&nbsp;<%= FormElement.Select(150, "ComplexityActualID", task.ComplexityActualID, complexityOptions, "", edit) %><% } %></td></tr></table></td>
                    </tr>
                    <tr>
                        <td align=right><b>Due Date:</b></td>
                        <% string dueDate = "";
                            if(task.DueDate.HasValue) {
                                dueDate = task.DueDate.Value.ToShortDateString();
                            } %>
                        <td><% if (edit) { %><%= CalendarInput.Calendar("DueDate", task.DueDate) %><% } else { %><%= dueDate %><% } %></td>
                    </tr>
                    <tr>
                        <td colspan=2 height=2></td>
                    </tr>
                    <tr>
                        <td align=right><% if (task.ID > 0) { %><b>Complete:</b><% } %></td>
                        <td style="white-space:nowrap;"><% if (task.ID > 0) { %><%= FormElement.CheckBox("IsComplete", taskComplete, "Yes (" + task.ClosedDateTime + ")|No", " OnClick=\"noteComplete(this);\"", edit, !edit)%><% } %>
                        <% if (edit) { %><span style="width:85%;text-align=center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<% if (task.ID > 0) { %><button type="button" onclick="confirmDelete(<%= task.ID %>);">Delete</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<% } %><button type="button" onclick="cancel();">Cancel</button>&nbsp;<button type="button" id="saveButton" onclick="this.disabled=true;saveTask(document.taskForm.ReleaseID.options[document.taskForm.ReleaseID.selectedIndex].value, document.taskForm.TaskStatus.options[document.taskForm.TaskStatus.selectedIndex].value, document.taskForm.TaskContainerID.value, <%= task.ID %>, document.taskForm.TaskTypeID.options[document.taskForm.TaskTypeID.selectedIndex].value, document.taskForm.Title.value, document.taskForm.Description.value, <%= Session["MemberID"] %>, document.taskForm.HoursEstimated.value, document.taskForm.Hours.value, document.taskForm.IsComplete.checked, document.taskForm.Notes.value, document.taskForm.PriorityID.options[document.taskForm.PriorityID.selectedIndex].value, document.taskForm.NoteDateTime.value);">Save Changes</button></span><% } %></td>
                    </tr>
                    
                </table>
                </div>
            </td>
        </tr>
        <% if (task.ID > 0) { %>
        <tr>
            <td width="90%" height=3></td>
        </tr>
        <tr>
		    <td align=left valign=bottom height=21 background="images/task-highlight.png" style="padding:0px">
                <div class="Tab-Blank">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
		        <div id="tabnotes" OnMouseOver="chkTab(this, 'tabnotes')" OnMouseOut="chkOutTab(this, 'tabnotes');" class="Tab-Over" onclick="show('notes');">Task Notes</div>
		        <div id="tabattachments" OnMouseOver="chkTab(this, 'tabattachments')" OnMouseOut="chkOutTab(this, 'tabattachments');" class="Tab" onclick="show('attachments');">Attachments (<%= attachmentCount %>)</div>
		        <div id="tabsvn" OnMouseOver="chkTab(this, 'tabsvn')" OnMouseOut="chkOutTab(this, 'tabsvn');" class="Tab" onclick="show('svn');">SVN Commits (<%= svnCount %>)</div>
		        <div id="tabrelease" OnMouseOver="chkTab(this, 'tabrelease')" OnMouseOut="chkOutTab(this, 'tabrelease');" class="Tab" onclick="show('release');">QA Report Items</div>
            </td>
        </tr>
    </table>
    <div id="attachments" style="display:none">
    <table  width="100%">
        <tr>
            <td width="90%" style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE"><b>Associated Attachments</b></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" valign=top>
            &nbsp;<br />
            <%= attachmentList %>
            &nbsp;
            </td>
        </tr>
    </table>
    </div>
     <div id="svn" style="display:none">
    <table  width="100%">
        <tr>
            <td width="90%" style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE"><b>SVN Commits</b></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" valign=top>
            <%= svnList %>
            </td>
        </tr>
    </table>
    </div>
     <div id="release" style="display:none">
    <table  width="100%">
        <tr>
            <td width="90%" style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE"><b>QA Report</b></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" valign=top>
            TBC
            </td>
        </tr>
    </table>
    </div>
    <div id="notes">
    <table width=100%>
        <tr>
            <td width="90%" style="white-space:nowrap;color:#ffffff" bgcolor="#869AAE"><b>Task Notes</b>
            <% if (!ReadOnly) { %><span style="width:83%;text-align:right;" id="addNewNote"><a href="javascript:OnClick=showHideNoteForm('none', 'inline')" style="color:#ffffff">Add New Note</a></span><% } %></td>
        </tr>
        <tr>
            <td style="border:1px solid #6893cf;" valign=top id="noteList">
                <table width=100%>
                <%= taskNotes%>
                </table>
            </td>
        </tr>
        <tr id="noteForm" style="display:none">
            <td valign=top style="height:100%">
                <table width="90%" align=center>
                    <tr>
                        <td align=right valign=top width=24%><b>Notes:</b></td>
                        <td>
                            <%= FormElement.TextArea(81, 10, "Notes", "", "", true)%>
                        </td>
                    </tr>
                    <tr>
                        <td align=right><b>Hours:</b></td>
                        <td><%= FormElement.TextBox(4, "Hours", "0", "", true) %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Date:</b></td>
                        <td><%= CalendarInput.Calendar("NoteDateTime", DateTime.Now.ToShortDateString()) %></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td align=center id="noteFormBtns">
                            <button type="button" onclick="showHideNoteForm('inline', 'none');">Cancel</button>
                            &nbsp;&nbsp;&nbsp;<button type="button" onclick="addNote(document.taskForm.Notes.value, document.taskForm.Hours.value, document.taskForm.NoteDateTime.value, this);this.disabled=true;">Add Note</button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr id="EditNoteForm" style="display:none">
            <td valign=top style="height:100%">
                <table width="90%" align=center>
                    <tr>
                        <td align=right valign=top width=24%><b>Notes:</b></td>
                        <td>
                            <%= FormElement.TextArea(81, 10, "EditNotes", "", "", true)%>
                        </td>
                    </tr>
                    <tr>
                        <td align=right><b>Hours:</b></td>
                        <td><%= FormElement.TextBox(4, "EditHours", "0", "", true) %></td>
                    </tr>
                    <tr>
                        <td align=right><b>Date:</b></td>
                        <td><%= CalendarInput.Calendar("EditNoteDateTime", DateTime.Now.ToShortDateString()) %></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td align=center id="noteFormBtns">
                            <button type="button" onclick="cancelEditNote();">Cancel</button>
                            &nbsp;&nbsp;&nbsp;<button type="button" onclick="updateNote(document.taskForm.EditNotes.value, document.taskForm.EditHours.value, document.taskForm.EditNoteDateTime.value);">Save Changes</button>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </div>
    <% } %>
    </form>
    <a name="bottom"></a>